package io.renren.modules.hospital.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import io.renren.modules.hospital.entity.EmrXyModelEntity;
import io.renren.modules.hospital.service.EmrXyModelService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 *
 *
 * @author starry
 * @email 2495646304@qq.com
 * @date 2024-01-29 18:00:41
 */
@RestController
@RequestMapping("hospital/emrxymodel")
@Api(value = "EMR西医病历模板接口", tags = "EMR西医病历模板接口")
public class EmrXyModelController {
    @Autowired
    private EmrXyModelService emrXyModelService;

    /**
     * 列表
     */
    @GetMapping("/list")
    @ApiOperation("列表")
    //@RequiresPermissions("hospital:emrxymodel:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = emrXyModelService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{emrXyId}")
    @ApiOperation("信息")
    //@RequiresPermissions("hospital:emrxymodel:info")
    public R info(@PathVariable("emrXyId") Integer emrXyId){
		EmrXyModelEntity emrXyModel = emrXyModelService.getById(emrXyId);

        return R.ok().put("emrXyModel", emrXyModel);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    @ApiOperation("保存")
    //@RequiresPermissions("hospital:emrxymodel:save")
    public R save(@RequestBody EmrXyModelEntity emrXyModel){
		emrXyModelService.save(emrXyModel);

        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    @ApiOperation("修改")
    //@RequiresPermissions("hospital:emrxymodel:update")
    public R update(@RequestBody EmrXyModelEntity emrXyModel){
		emrXyModelService.updateById(emrXyModel);

        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    @ApiOperation("删除")
    //@RequiresPermissions("hospital:emrxymodel:delete")
    public R delete(@RequestBody Integer[] emrXyIds){
		emrXyModelService.removeByIds(Arrays.asList(emrXyIds));

        return R.ok();
    }

}
